<template>
    <div class="ForgetPassword">
        <!-- 导航 -->
        <div class="nav-bar">
            <van-nav-bar>
                <template #left>
                    <div class="nav-logo">
                        <div class=""><img src="../assets/images/home_active.png" alt=""></div>
                        <div>Luckin&nbsp;Coffee</div>
                    </div>
                </template>
                 <template #right>
                     <div class="nav-right" @click="goback">先逛一逛</div>
                </template>
            </van-nav-bar>
        </div>

         <!-- 找回密码 -->
        <div class="welcome">
            <div class="ch-wel">找回密码</div>
            <div class="en-wel">Find Password</div>
        </div>

        <!-- 表单 -->
        <div class="form-box">
            <van-form >
                    <van-field
                        v-model="email"
                        name="phone"
                        label="邮箱"
                        placeholder="邮箱"
                        :rules="[{ required: true, message: '请填写邮箱' },{pattern:emailReg,message:'邮箱格式不正确'}]"
                    />
                    <van-field
                        name="password"
                        label="短信验证码"
                        placeholder="请输入短信验证码"
                        autocomplete="off"
                    >
                    <template #button>
                        <van-button size="small" type="primary">发送验证码</van-button>
                    </template>
                    </van-field>
                    <div class="forgot-box">
                        <div class="forgot-text" @click="tologin">
                            已有账号，立即登录
                        </div>
                    </div>
                    <div style="margin: 16px;">
                        <van-button round block color="#0C34BA" native-type="submit" >下一步</van-button>
                    </div>
            </van-form>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                email:'',
                emailReg:/^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/
            }
        },
        methods: {
            // 点击逛一逛
            goback(){
                console.log(11);
                this.$router.push({name:'Home'})
            },
            // 点击返回注册
            tologin(){
                this.$router.push({name:'Login'})
            }
        },
    }
</script>

<style lang="less" scoped>
.forgot-box{
        margin-top: 10px;
        display: flex;
        .forgot-text{
            margin-left: auto;
            font-size: 14px;
            color: #666;
        }
    }
// 找回密码
.welcome{
    margin-top: 80px;
    padding: 10px;
    .ch-wel{
        font-size: 26px;
        color: #666;
        font-weight: bold;
    }
    .en-wel{
        font-size: 14px;
        color: #666;
        margin-top: 20px;
    }
}
// 导航
.nav-bar{
    .nav-logo{
        display: flex;
        align-items: center;
        div{
            flex: 1;
            font-size: 16px;
            color: #666;
            font-weight: bold;
            img{
                width: 40px;
                height: 40px;
                border-radius: 50%;
                margin-right: 10px;
            }
        }
    }
    .nav-right{
        color: #0C34BA;
        font-size: 16px;
        font-weight: bold;
    }
}
// 验证码按钮样式
.van-button--primary{
    background-color: #0C34BA;
    border-color: #0C34BA;
}
</style>